#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;

int ans = 0;
int board[10][10] = { 2 };

bool judge(int x, int y)
{
	if (x != 4 && y != 4)
		return true;

	bool all = true;
	if (x == 4)
	{
		for (int i = 0; i < 5; i++)
		{
			if (board[i][y] != board[x][y])
			{
				all = false;
				break;
			}
		}

		if (all)
			return false;
	}

	all = true;

	if (y == 4)
	{
		for (int i = 0; i < 5; i++)
		{
			if (board[x][i] != board[x][y])
			{
				all = false;
				break;
			}
		}

		if (all)
			return false;
	}

	all = true;

	if (x == 4 && y == 0)
	{
		for (int i = 0; i < 5; i++)
		{
			if (board[i][4 - i] != board[4][0])
			{
				all = false;
				break;
			}
		}
		if (all)
			return false;
	}

	all = true;

	if (x == 4 && y == 4)
	{
		for (int i = 0; i < 5; i++)
		{
			if (board[i][i] != board[4][4])
			{
				all = false;
				break;
			}
		}
		if (all)
			return false;
	}

	return true;
}
void dfs(int depth, int white, int black)
{

	if (depth == 25)
	{
		++ans;
		return;
	}

	int x = depth / 5;
	int y = depth % 5;

	if (white > 0)
	{
		board[x][y] = 0;
		if (judge(x, y))
		{
			dfs(depth + 1, white - 1, black);
		}
		else
		{
			board[x][y] = 0;
		}
	}

	if (black > 0)
	{
		board[x][y] = 1;
		if (judge(x, y))
		{
			dfs(depth + 1, white, black - 1);
		}
		else
		{
			board[x][y] = 0;
		}
	}

}
int main()
{
	dfs(0, 13, 12);
	cout << ans;
	return 0;
}